package com.oa.oaspcpersonalcenter.service.impl;



import com.oa.oaspccommon.po.Salary;
import com.oa.oaspcpersonalcenter.mapper.SalaryMapper;
import com.oa.oaspcpersonalcenter.service.SalaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Sdx
 * 2021-04-15
 */
@Service
public class SalaryServiceImpl implements SalaryService {

    @Autowired(required = false)
    private SalaryMapper salaryMapper;

    @Override
    public List<Salary> findSalarys() {
        return salaryMapper.findSalarys();
    }

    @Override
    public Salary findSalaryByUidAndSid(int uid, double sid) {
        return salaryMapper.findSalaryByUidAndSid(uid, sid);
    }

    @Override
    public boolean addSalary(Salary salary) {
        try {
            salaryMapper.addSalary(salary);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;

    }

    @Override
    public boolean updateSalary(Salary salary) {
        try {
            salaryMapper.updateSalary(salary);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }

    @Override
    public boolean deleteSalaryByUidAndSid(int uid, double sid) {
        try {
            salaryMapper.deleteSalaryByUidAndSid(uid, sid);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
}
